import requests

# 获得COOKIE
r = requests.get("http://127.0.0.1:8000/auth/", params={
    "username": "admin",
    "password": "123456"
})

r.raise_for_status()

# 设置COOKIE
u = requests.post("http://127.0.0.1:8000/upload/",
                  files={"file": open("./movies.txt", "rb")},
                  cookies=r.cookies
                  )
u.raise_for_status()
print(r.text)

